package com.wlps.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 任务单表(mission_list)
(1.当任务单状态为已分配时，不可以再进行该用例。)
(2.当订单形成任务单，分配具体执行任务的配送员。)
 * </p>
 *
 * @author ZWYZY
 * @since 2020-07-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mission_list")
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="MissionList对象", description="任务单表(mission_list) (1.当任务单状态为已分配时，不可以再进行该用例。) (2.当订单形成任务单，分配具体执行任务的配送员。)")
public class MissionList implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "任务号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "配送员代号/员工id.员工表外键")
    private Long userId;

    @ApiModelProperty(value = "配送费")
    private Double serviceMoney;

    @ApiModelProperty(value = "客户id,客户表外键")
    private Long clientId;

    @ApiModelProperty(value = "客户满意度")
    private String customerSatisfaction;

    @ApiModelProperty(value = "任务类型,送货收款(0)、 换货(1)、 退货(2)、 默认为0")
    private Integer taskType;

    @ApiModelProperty(value = "任务状态,配送员分配中(-1)、已领货(0)、 部分完成（1）、 完成（2）、 失败（3）、 已退货（4）、默认-1")
    private Integer taskStatus;

    @ApiModelProperty(value = "客户反馈")
    private String clientFeedback;

    @ApiModelProperty(value = "服务时间信息")
    private String servicetimeInformation;

    @ApiModelProperty(value = "备注信息")
    private String remark;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")//数据库导出页面时json格式化
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")//数据库导出页面时json格式化
    @ApiModelProperty(value = "更新时间")
    @TableField("update_time")
    private Date updateTime;

    @ApiModelProperty(value = "订单号")
    private Long orderId;



    public MissionList(Long userId, Long orderId, Long clientId,Integer taskType, Double serviceMoney, String remark) {
        this.userId=userId;
        this.clientId=clientId;
        this.serviceMoney=serviceMoney;
        this.remark=remark;
        this.customerSatisfaction="未评价";
        this.taskType=taskType;
        this.taskStatus=-1;
        this.customerSatisfaction="未反馈";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.servicetimeInformation=simpleDateFormat.format(new Date());
        this.orderId=orderId;
    }
}
